<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>/public/js/Flexigrid-master/css/flexigrid.pack.css"/>
<script src="<?php echo base_url();?>/public/js/Flexigrid-master/js/flexigrid.pack.js" type="text/javascript"></script>

<table class="datosDatagrip"></table>
<div id="cajaDialogo"></div>

<script>
    $('.datosDatagrip').flexigrid({
        url:'<?php echo site_url() ?>/datocliente/data/',
        dataType: 'json',
        colModel : [
            {display: '', name : '', width : 0, sortable : true, align: 'center'},
            {display: '', name :'', width : 150, sortable : true, align: 'left'}

        ],
        searchitems : [
            {display: '', name :'Referencia', isdefault: true}
        ],
        buttons : [
            {name: 'Agregar', bclass: 'add', onpress:agregar},
            {separator: true},
            {name: 'Editar', bclass: 'editar', onpress:excel},
            {separator: true},
             {name: 'Eliminar', bclass: 'delete', onpress:eliminar},
            {separator: true}
        ],
        title: "",
        sortname: '',
        sortorder: 'asc',
        multiselect: false,
        usepager: true,
        rp: 10,
        showTableToggleBtn: true,
        width: 'auto',
        height: 'auto',
        resizable: false,
        multidatagrip:false,
        multidatagripL:false
    })
    
    function agregar(){
        
       var id = $(".trSelected #Id_Referencia div").html(); 
       
       if(id == null){
            alert("Debe seleccionar un registro.");
           
        }else{
    
            
        }
       
    }
    
       function editar(){
    
   
       
    }
    
    function eliminar(){
        var id = $(".trSelected #id_pais div").html(); 
        
        if(id == null){
            mensajeError("Debe seleccionar un registro.");
            return;
        }
        
      
    }
    
  </script>